package org.yagnus.stats.summary.univariate;

/**
 * 
 * The micro average of n values x_i weighted respectively by w_i is
 * 
 * \sum{x_i} / sum{w_i};
 * 
 * @author u
 * 
 */
public class MicroAverage extends UnivariateWeightedSummaryStatistic<Double> {

	double top, bottom;

	public MicroAverage() {
		clear();
	}

	@Override
	public Double get() {
		return top / bottom;
	}

	@Override
	public void clear() {

		top = bottom = 0;

	}

	@Override
	public void add(Double data, double weight) {
		top += data;
		bottom += weight;
	}

}
